﻿// 确认

using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections.Generic;
using UIKit;

namespace DemoProject
{
    public class ConfirmForms : BaseUIForms
    {
        public Text TextConfirmWindow;
        public Text TextConfirm;
        public Text TextConfirmCancle;

        void Awake()
        {
            //本窗体属性
            CurrentUIType.UIForms_Type = UIFormsType.PopUp;
            CurrentUIType.UIForms_ShowMode = UIFormsShowMode.ReverseChange;

            //事件注册
            AddClickEventListener("BtnConfirm",ConfirmPurcherGoods);
            AddClickEventListener("BtnCancel",
                p => CloseUIForms<ConfirmForms>()
            );
        }//Awake_end

        void Start()
        {
            if (TextConfirmWindow)
            {
                TextConfirmWindow.text = ShowText("ConfirmWindow");
            }
            if (TextConfirm)
            {
                TextConfirm.text = ShowText("Confirm");
            }
            if (TextConfirmCancle)
            {
                TextConfirmCancle.text = ShowText("Cancle");
            }
        }//Start_end

        #region  窗体生命周期
        public override void OnOpen()
        {
            base.OnOpen();
            Log.Write(GetType() + "/OnOpen()");
        }

        public override void OnReOpen()
        {
            base.OnReOpen();
            Log.Write(GetType() + "/OnReOpen()");
        }

        public override void OnFreeze()
        {
            base.OnFreeze();
            Log.Write(GetType() + "/OnFreeze()");
        }

        public override void OnClose()
        {
            base.OnClose();
            Log.Write(GetType() + "/OnClose()");
        }
        #endregion

        /// <summary>
        /// 确认(购买物品)
        /// </summary>
        private void ConfirmPurcherGoods(GameObject go)
        {
            //todo...
        }
    }//Class_end
}